<template>
	<view class="community">
		<view class="head_bg2" style="padding-top: 10rpx;">
			<view class="community_msg">
				<view class="community_msg_line">
					<image class="community_msg_icon" src="../../../common/img/gongsi_bai.png" mode=""></image>
					<text class="community_msg_text">{{guidinfo.residential_quarters_name}}</text>
				</view>
				<view class="community_msg_line">
					<image class="community_msg_icon" src="../../../common/img/dizhi_bai.png" mode=""></image>
					<text class="community_msg_text">{{guidinfo.residential_quarters_address}}</text>
				</view>
			</view>
		</view>
		<view class="big_box" style="margin-top: -40rpx;">
			<view class="operating_box" v-for="(info,index) in list" :key="index" style="margin-top:20rpx;">
				<view class="count_title_box">
					<text class="count_title">{{info.settlement_time}}</text>
					<view class="count_right">
						<view style="margin-right: 30rpx;"><text class="count_right_blod" style="margin-right: 10rpx;">分成：{{info.settlement_amount}}元</text></view>
						<!--<view><text class="count_right_blod" style="margin-right: 10rpx;">0.9</text>元/次</view>-->
					</view>
				</view>
				<view class="count_inner">
					<view class="count_line">
						<view class="count_line_left">收入： </view>
						<view class="count_line_right">{{info.set_meal_income}}元</view>
					</view>
					<view class="count_line">
						<view class="count_line_left">订单： </view>
						<view class="count_line_right">{{info.order_num}}次</view>
					</view>
					<view class="count_line">
						<view class="count_line_left">套餐： </view>
						<view class="count_line_right"> {{info.set_meal_income}}元</view>
					</view>
					<view class="count_line">
						<view class="count_line_left">电费： </view>
						<view class="count_line_right"> {{info.order_electricity_fees}}度</view>
					</view>
					<view class="count_line">
						<view class="count_line_left">用电量： </view>
						<view class="count_line_right"> {{info.power_consumption}}度</view>
					</view>
					<!--<view class="count_line">
						<view class="count_line_left">物业：</view>
						<view class="count_line_right"> -200元</view>
					</view>
					<view class="count_line">
						<view class="count_line_left">平台： </view>
						<view class="count_line_right"> -300元</view>
					</view>-->
				</view>
				<!--<view class="count_bottom">
					<view class="count_bottom_inner">结算：
					<text class="count_bottom_inner_1">￥</text>
					<text class="count_bottom_inner_2">520</text>
					利润：
					<text class="count_bottom_inner_1">￥</text>
					<text  class="count_bottom_inner_2" style="margin-right: 0;">250</text></view>
				</view> -->
			</view>
			<view v-if="list.length==0" class="margin-top-lg text-center">
				<image src='../../../common/img/no_data.png' style="width:275rpx;height:312rpx;"></image>
			</view>
		</view>
		<view v-if="list.length>0" class="text-black text-df text-center bg-white padding-sm padding-left-lg be-gray">
			{{loadingTxt}} 共({{list.length}}条记录)
		</view>
	</view>
</template>

<script>
	let page=1,timer=null
	export default {
		data() {
			return {
				list:{},
				page:1,
				loadingTxt:'加载更多',
                residential_quarters_guid:'',
				guidinfo:'',
				totle:1,
				info:{
					settlement_amount:0.00,//	浮点型	结算金额
					set_meal_income:0.00,//	浮点型	套餐收入
					order_income:0.00,//	浮点型	订单收入
					power_consumption:0.00,//	浮点型	消耗电量
					order_electricity_fees:0.00,//	浮点型	订单电费
					order_num:0,  //整型	订单数
				}
			}
		},
		onLoad(options) {
			let guidinfo=JSON.parse(options.item);
			this.guidinfo=guidinfo;
		},
		onShow() {
			page=1;
			this.getList();
		},
		methods: {
			getList(){
				let that=this;
				that.http.tokenreq({
					url: 'agent/v1/villageday',
					data:{
						'residential_quarters_guid':that.guidinfo.residential_quarters_guid,
						'pageindex':page
					}
				}).then((res) => {
					let e=res.data;
					if(e.code==0 && e.success){
						that.list=e.rows;
						page++;
					}else{
						uni.showModal({
							content:e.message,
							showCancel:false,
						})
					}
				})
			},
			getmorelist(){
				this.loadingTxt='加载中'
				let that=this;
				that.http.tokenreq({
					url: 'agent/v1/villageday',
					data:{'residential_quarters_guid':that.guidinfo.residential_quarters_guid,
						'pageindex':page
					}
				}).then((res) => {
					uni.hideLoading();
					let e=res.data;
					if(e.code==0 && e.success){
						if(e.rows.length==0){
							that.loadingTxt="已经加载全部";
							return;
						}
						that.list=that.list.concat(e.rows);
						page++
					}else{
						uni.showModal({
							content:e.message,
							showCancel:false,
						})
					}
				})
			},
			onReachBottom() {
				//阻止重复加载
				if(timer !== null){
					clearTimeout(timer)
				}
				timer=setTimeout(()=>this.getmorelist(),500)
			}
		}
	}
</script>
<style>
	.operating_box{
		padding-bottom: 0;
	}
	.head_bg2{
		width: 100%;
	    height: 138px;
		padding-top: 22px;
		background: #52ABFB;
		/* background-image: url(/static/img/beiing.079977d8.png); */
		background-size: 100% 100%;
	}
</style>
